<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:72:"E:\WWW\huzhanwang.cc\public/../application/admin\view\banner\update.html";i:1700216320;}*/ ?>


<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layuiAdmin 网站用户 iframe 框</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>
<style type="text/css">
</style>
 <form class="layui-form">
  <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    
    <div class="layui-form-item">
      <label class="layui-form-label">选择banner</label>
      <div class="layui-input-block">
        <div class="layui-input-inline"  style="width:400px">
        <input type="text" name="path"  id="path" lay-verify="<?php echo !empty($data)?'' : 'required'; ?>"  placeholder="请上传图片" autocomplete="off" class="layui-input" value="<?php echo !empty($data)?$data['path'] : ''; ?>">
      </div>
      <div class="layui-input-inline">
      <button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-useradmin">上传图片(345*200px)</button>
      </div>
      </div> 
    </div>
     <div class="layui-form-item">
      <label class="layui-form-label"></label>
      <div class="layui-input-inline">
        <img style="width:80px;" class="layui-upload-img" id="demo1" src="<?php echo !empty($data)?$data['path'] : ''; ?>">
        <p id="demoText"></p>
      </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">url</label>
        <div class="layui-input-block">
          <input type="text" name="url" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo !empty($data)?$data['url'] : ''; ?>">
        </div>
    </div>
    <div class="layui-form-item">
          <label class="layui-form-label">排序</label>
          <div class="layui-input-block">
            <input type="text" name="sort" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="<?php echo $data['sort']; ?>">
          </div>
    </div>
     <div class="layui-form-item" lay-filter="sex">
      <label class="layui-form-label">状态</label>
      <div class="layui-input-block">
        <?php if(!empty($data)){ ?>
        <input type="radio" name="status" value="1" title="启用"  <?php echo $data['status']==1?'checked' : ''; ?>>
        <input type="radio" name="status" value="2" title="禁用"  <?php echo $data['status']==2?'checked' : ''; ?>>
        <?php }else{ ?>
        <input type="radio" name="status" value="1" title="启用" checked>
        <input type="radio" name="status" value="2" title="禁用" >
        <?php } ?>
      </div>
    </div>
      </div>
    </div>

    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
  </div>
</form>
  <script src="/static/admin/layuiadmin/layui/layui.js"></script>  
  <script>
    //富文本
//     layui.use(['layedit','form'], function(){
//   var layedit = layui.layedit;
//   var index0=layedit.build('demo'); //建立编辑器
//   var form = layui.form;
//       form.verify({
//             content0: function(value) {
//                 return layedit.sync(index0);
//             }
//        });
// });
    //时间
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  //执行一个laydate实例
  laydate.render({
    elem: '#test1' //指定元素
  });
  laydate.render({
    elem: '#test2' //指定元素
  });
});
</script>
  <script>
  layui.config({
    base: '/static/admin/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'upload'], function(){
    var $ = layui.$
    ,form = layui.form
    ,upload = layui.upload ;
    
    upload.render({
      elem: '#layuiadmin-upload-useradmin'
      ,url: "<?php echo url('/admin/banner/upload'); ?>"
      ,auto: true //选择文件后自动上传
      // ,bindAction: '#LAY-user-front-submit'
      ,field:'image'
      ,accept: 'images'   //指定允许上传时校验的文件类型
      ,method: 'post'
      ,acceptMime: 'image/*'
      ,multiple: false  
      ,done: function(res){  //执行上传请求后的回调。返回三个参数
        $("#path").val(res.data)
        $('#demo1').attr('src', res.data); //图片链接（base64）
        layer.msg('上传成功', {
                  offset: '15px'
                  ,icon: 1
                  ,time: 1000
                });
      },error:function(res){

      }
    });
    //   //监听提交
    // form.on('submit(LAY-user-front-submit)', function(data){
    //   layer.msg(JSON.stringify(data.field));
    //   console.log(data.field);
    //   return false;
    // });
  })
  </script>
</body>
</html>